# TODO 14: Remove mysqrt.cxx from the list of sources
add_library(MathFunctions MathFunctions.cxx MathFunctions.h)

# TODO 1: 添加一个MathFunctions库（这里我们将.h文件也添加进来），Add a library called MathFunctions with sources MathFunctions.cxx
# and mysqrt.cxx
# Hint: You will need the add_library command
# add_library(MathFunctions mysqrt.cxx MathFunctions.cxx MathFunctions.h)

# TODO 7: 创建可选变量，Create a variable USE_MYMATH using option and set default to ON
option(USE_MYMATH "Use math" ON)
message(STATUS ">>> USE_MYMATH="${USE_MYMATH})

# TODO 8: 如果USE_MYMATH开启
# If USE_MYMATH is ON, use target_compile_definitions to pass
# USE_MYMATH as a precompiled definition to our source files
if(USE_MYMATH)
    target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH")
endif()

# TODO 12: 如果USE_MYMATH开启，那么将mysqrt.cxx添加SqrtLibrary库
# When USE_MYMATH is ON, add a library for SqrtLibrary with
# source mysqrt.cxx
if(USE_MYMATH)
    add_library(SqrtLibrary STATIC mysqrt.cxx)
endif()
# TODO 13: When USE_MYMATH is ON, link SqrtLibrary to the MathFunctions Library
if(USE_MYMATH)
    target_link_libraries(MathFunctions PUBLIC SqrtLibrary)
endif()